Skip to main content

Writing

To write a state-changing transaction to the blockchain, use the useSendTransaction hook.

Simply call a hook in a component:

  const { sendTransaction } = useSendTransaction()

Typically you would use the sendTransaction in a click button handler:

  const handleClick = () => {
setDisabled(true)
sendTransaction({ to: address, value: utils.parseEther(amount) })
}

See the Ether Transactions guide for a more in-depth explanation, or take a look at Contract Functions if you are interested in writing transactions to contracts.